package stream;

import org.junit.Test;

import java.io.*;

public class StreamTest {


    @Test
    public void test1() throws IOException {
        // 输出流
        FileOutputStream fileOutputStream = new FileOutputStream("out.txt");
        DataOutputStream dataOutputStream = new DataOutputStream(fileOutputStream);


        // 输出任意数据类型
        dataOutputStream.writeBoolean(true);
        dataOutputStream.writeByte(1);

        FileInputStream fileInputStream = new FileInputStream("out.txt");
        DataInputStream dataInputStream = new DataInputStream(fileInputStream);
        byte b1 = dataInputStream.readByte();
        byte b = dataInputStream.readByte();
        System.out.println(b);
        System.out.println(b1);
    }
}
